package com.cyz.web.app.leetcode.palindrome;

public class Client {

    public static void main(String[] args) {
        Client c = new Client();


        boolean res= c.palindrome(22022);
        System.out.println(res);
    }

    /**
     * 校验是否回文数
     * @param x
     * @return
     */
    public boolean palindrome(int x){
        if (x<0 || (x%10==0 && x!=0))return false;

        boolean flag = true;
       byte[] bytes = String.valueOf(x).getBytes();
       int len = bytes.length-1;
       for (int i=0;i<len;i++){
           if (bytes[i] != bytes[len-i] ){
               flag = false;
           }
       }

       return flag;
    }



}
